
package com.example.tests;

import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.*;
import java.util.Random;
import org.testng.annotations.Test;
import com.example.utils.SortedListOf;

public class GroupRemoveTests extends TestBase {

  @Test
  public void testGroupRemove() throws Exception {
    
    // save old state
	SortedListOf<GroupData> oldlist = app.getGroupHelper().getGroups();
    
    Random rnd = new Random();
    int index = rnd.nextInt(oldlist.size()-1);
    
    //actions
    app.getGroupHelper().deleteGroupForm(index);
    
    //save new state
    SortedListOf<GroupData> newlist = app.getGroupHelper().getGroups();
	 
	 //compare states
	 assertThat(newlist, equalTo(oldlist.without(index)));  
  }
  
}

